 package com.gmrz.uaf.crypto.internal.keyFormats;
 
 import com.gmrz.uaf.crypto.CryptoConstants;
 import com.gmrz.uaf.crypto.spi.UAFKeyFormat;
import java.security.GeneralSecurityException;
import java.security.KeyFactory;
import java.security.PublicKey;
import java.security.spec.X509EncodedKeySpec;
 
 public class UAFKeyFmt
   implements UAFKeyFormat
 {
   protected CryptoConstants.UAFAlgkey uafAlgKey;
 
   public int getFormat()
   {
     return this.uafAlgKey.getFormat();
   }
 
   public String getName()
   {
     return this.uafAlgKey.getName();
   }
 
   public PublicKey getKey(byte[] pubKey, int algoSuite)
     throws GeneralSecurityException
   {
     KeyFactory factory = KeyFactory.getInstance(this.uafAlgKey.getKeyAlgo());
     return factory.generatePublic(new X509EncodedKeySpec(pubKey));
   }
 
   public UAFKeyFmt(CryptoConstants.UAFAlgkey uafAlgKey) {
     this.uafAlgKey = uafAlgKey;
   }
 
   public String toString()
   {
     return "UAFKeyFmt [getFormat()=" + getFormat() + ", getName()=" + getName() + "]";
   }
 }
